#!/usr/bin/perl -w
  
  # index.pl
use strict;
  use CGI;
  use CGI::Carp qw/fatalsToBrowser warningsToBrowser/;

use lib qw( /var/pwneth/htdocs/rpg/lib );
use RedMoon::Account;
  
my $q = new CGI;
my $reg = $q->param('register');
  
  if($reg)
  {
		my $pwn = RedMoon::Account->new;
		my $r = $pwn->registerAcct($q);
		if($r)
		{
		print $q->header;
		print "Problem inserting acct: $r";
		}
		else
		{
	 	print $q->header(-location=>'login.pl');
		}
  }
  else
  {
      print $q->header;
      print <<HTML;
          <form method="post">
		  Email: <input type="text" name="email"><br/>
          Username: <input type="text" name="usr"><br/>
          Password: <input type="password" name="pwd"><br/>
		  Birthdate: <input type="text" name="birth"><br/>
          <input type="submit" name="register" value="Register">
          </form>
HTML
  }
